import request from '@/utils/request'
const api_name = '/course'

export default {
    // 获取讲师列表数据
    getList(page, limit, searchObj) {
        return request({
            url: `http://39.98.120.230:8080/api/course/list/${page}/${limit}`,
            method: 'post',
            data: searchObj
        })
    },
    deleteCourse(id){
        return request({
            url: `http://39.98.120.230:8080/api/course/${id}`,
            method: 'delete'
        })
    },
    // 添加课程基本信息
    addCourse(course){
        return request({
            url: `http://39.98.120.230:8080/api/course`,
            method: 'post',
            data: course
        })
    },
    // 根据id获取课程基本信息
    getCourseAddById(id){
        return request({
            url: `http://39.98.120.230:8080/api/course/${id}`,
            method: 'get'
        })
    },
    // 更新课程基本信息
    updateCourse(course){
        return request({
            url: `http://39.98.120.230:8080/api/course/${course.id}`,
            method: 'put',
            data: course
        })
    },
    // 根据id获取最终发布的信息
    getPublishInfoById(id){
        return request({
            url: `http://39.98.120.230:8080/api/course/publishinfo/${id}`,
            method: 'get'
        })
    },
    // 发布课程
    publishCourse(id){
        return request({
            url: `http://39.98.120.230:8080/api/course/publish/${id}`,
            method: 'put'
        })
    }
}